/**
 * 
 */
package edu.umd.clip.lm.model.data;

import java.io.IOException;

/**
 * @author Denis Filimonov <den@cs.umd.edu>
 *
 */
public class ProxyTrainingDataReader extends TrainingDataReader {
	private final ReadableTrainingData backend;
	
	/**
	 * @param backend
	 */
	public ProxyTrainingDataReader(ReadableTrainingData backend) {
		this.backend = backend;
	}

	/* (non-Javadoc)
	 * @see edu.umd.clip.lm.model.training.TrainingDataReader#getNextBlock()
	 */
	@Override
	public TrainingDataBlock getNextBlock() throws IOException {
		TrainingDataBlock block = backend.next();
		/*
		if (block == null || block.isTerminator()) {
			finishedReadingData();
		}
		*/
		return block;
	}

	/* (non-Javadoc)
	 * @see edu.umd.clip.lm.model.training.TrainingDataReader#start(edu.umd.clip.lm.model.training.ReadableTrainingData)
	 */
	@Override
	public void start(ReadableTrainingData data) {
		backend.start();
		data.setContextSize(backend.getContextSize());
	}

}
